<template>
    <div id="app">
        <router-view />
    </div>
</template>

<script>
import { OAuth } from '@aecworks/bimbox-toolkit';
import { RuntimeUtils } from './utils/runtime-util';

export default {
    methods: {
        getAccessTokenByPostMessage() {
            const oauth = new OAuth(window, window.top, RuntimeUtils.instance.bimboxOrigin);
            oauth
                .getAccessToken()
                .then((accessToken) => {
                    localStorage.setItem('kd-accessToken', accessToken);
                })
                .catch(() => {
                    // this.loadComponent = true
                });
        },
    },
    mounted() {
        this.getAccessTokenByPostMessage();
    },
};
</script>

<style>
html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#app {
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #2c3e50;
    width: 100%;
    height: 100%;
    position: relative;
}
</style>
